import Vue from 'vue'
import Router from 'vue-router'
import routers from './routers'
import { setDocumentTitle } from '@/utils/sesame-util'

Vue.use(Router)

const router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  scrollBehavior: (to, from, savedPosition) => {
    return { y: 0 }
  },
  routes: routers
})
export default router

router.beforeEach((to, from, next) => {
  setDocumentTitle(to.meta.title)
  next()
})

router.afterEach(() => {
})
